package com.project.mapper;

import com.github.pagehelper.PageInfo;
import com.project.bean.PurchaseBean;
import com.project.bean.PurchaseProductBean;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDate;
import java.util.List;

@Mapper
public interface IPurchaseMapper {
    /**
     * 按照id删除采购订单
     * @param id 采购id
     */
    @Delete("delete from sys_purchase where pk_purchaseId=#{id}")
    public void delById(int id);


    /**
     * 添加采购订单
     * @param purchase 采购订单对象
     */
    public void addPurchase(PurchaseBean purchase);

    /**
     * 按选项动态分页查询采购订单
     * 同时查询订单供应商名和采购员
     * @param supplier 供应商名
     * @param startDate 起始日期
     * @param endDate 结束日期
     * @return 分页对象
     */
    public List<PurchaseBean> findByItem(@Param("supplier") String supplier,@Param("startDate") LocalDate startDate,@Param("endDate") LocalDate endDate);


    /**
     * 按id查询订单商品明细
     * 同时查询商品信息
     * @param id
     * @return
     */
    public PurchaseBean findById(int id);
}
